{% extends 'KeioStudyBundle::layout.html.twig' %}

{% block content %}
    <h3>User list</h3>

    <table class="records_list" width="100%">
        <thead>
            <tr>
                <th class="records_list" style="width:7%; text-align:center">STT</th>
                <th class="records_list">Name</th>
                <th class="records_list">Email</th>
                <th class="records_list">Username</th>
                <th class="records_list">Roles</th>
                <th class="records_list" style="width:80px; text-align:center">Actions</th>
            </tr>
        </thead>
        <tbody>{% set sothutu = 0 %}
        {% for entity in entities %}
        {% set sothutu = sothutu+1 %}
        	<tr
        	{% if sothutu is divisibleby(2) %}
        	class="records_list_chan"
	        {% endif %}
	        >
                <td class="records_list" align="center">{{ sothutu }}</td>
                <td class="records_list">{{ entity.hoten }}</td>
                <td class="records_list">{{ entity.email }}</td>
                <td class="records_list">{{ entity.username }}</td>
                <td class="records_list" style="padding-bottom:15px">
                	{% for role in entity.roles %}
                	<br>{{ role }}
                	{% endfor %}
                </td>
                <td class="records_list">
                  <table width=100%>
    	            <tr>
	                  <td style="width:50%;">
                	<form action="{{ path('admin_user_delete', { 'id': entity.id }) }}" method="post">
            	        {{ form_widget(entity.delform) }}
        	            <div id="record_list">
	        	            <input title="Delete" type="image" src="{{ asset('icons/delete.png') }}" onclick="return confirm('Chắc chắn xóa không?')" />
        	            </div>
    	            </form>
	                  </td>
                	  <td style="width:50%; padding-left:5px">
            	        <a href="{{ path('admin_user_edit', { 'id': entity.id }) }}"><img title="Edit" src="{{ asset('icons/edit.png') }}" /></a>
        	          </td>
    	            </tr>
	              </table>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

        <ul>
        <li>
            <a href="{{ path('admin_user_new') }}">
                Create a new entry
            </a>
        </li>
    </ul>
    {% endblock %}
